<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>登录-医院管理系统</title>
    <link rel="icon" th:href="@{/images/timg.jpg}">
    <link rel="stylesheet" th:href="@{/hospital/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/hospital/css/index.css}" media="all">
    <link rel="stylesheet" th:href="@{/hospital/css/public.css}" media="all">
    <style>
        .loginBody {
            background: url([[@{/}]]images/login_bg.jpg) no-repeat center center;
            margin-top: 580px;
            -webkit-background-size: 1920px;
            background-size: 1720px 930px;
        }
    </style>
    <link id="layuicss-layer" rel="stylesheet" th:href="@{/hospital/layui/css/layer.css}" media="all">
</head>
<body class="loginBody">
<form class="layui-form" id="loginFrm" th:action="@{/page/toIndex}" method="post">
    <div class="login_face"><img th:src="@{/hospital/timg.jpg}" class="userAvatar"></div>
    <div class="layui-form-item input-item">
        <label>用户名</label>
        <input type="text" id="loginname" placeholder="请输入用户名" autocomplete="off" name="loginName" class="layui-input"
               lay-verify="required" value="admin">
    </div>
    <div class="layui-form-item input-item">
        <label>密码</label>
        <input type="password" id="pwd" placeholder="请输入密码" autocomplete="off" name="pwd" class="layui-input"
               lay-verify="required" value="123456">
    </div>
    <div class="layui-form-item input-item">
        <span id="msg" th:text="${error}">
            
        </span>
    </div>
    <div class="layui-form-item">
        <button class="layui-btn layui-block" lay-filter="login" lay-submit="">登录</button>
    </div>
</form>
<script type="text/javascript" th:src="@{/hospital/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/hospital/layui/lay/modules/jquery.min.js}"></script>
<script th:inline="javascript">

    layui.use(['form', 'layer', 'jquery'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer
        $ = layui.jquery;
        //登录按钮
        // form.on("submit(login)", function (data) {
        //     $(this).text("登录中...").attr("disabled", "disabled").addClass("layui-disabled");
        //     setTimeout(function () {
        //         $("#loginFrm").submit();
        //     }, 1000);
        //     return false;
        // })
        $("#loginname").click(function () {
            $("#msg").fadeOut(500);
        })
        $("#pwd").click(function () {
            $("#msg").fadeOut(500);
        })
        //表单输入效果
        $(".loginBody .input-item").click(function (e) {
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        })
        $(".loginBody .layui-form-item .layui-input").focus(function () {
            $(this).parent().addClass("layui-input-focus");
        })
        $(".loginBody .layui-form-item .layui-input").blur(function () {
            $(this).parent().removeClass("layui-input-focus");
            if ($(this).val() != '') {
                $(this).parent().addClass("layui-input-active");
            } else {
                $(this).parent().removeClass("layui-input-active");
            }
        })

    })

</script>

</body>
</html>